<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>平移效果</title>
    <style>
        .father {
            width: 500px;
            height: 300px;
            margin: 100px auto;
            border: 1px solid #000;
        }
        
        .son {
            width: 200px;
            height: 100px;
            background-color: pink;
            transition: all 0.5s;
        }
    
        /* 鼠标移入父亲盒子，儿子盒子移动 */
        .father:hover .son {
            /* 向左移动200px，向下移动100px */
            transform: translate(200px, 100px);

            /* 百分比写法，百分比都是针对的盒子自身尺寸的计算结果 */
            transform: translate(50%, 100%);
            transform: translate(100px);
        }

    </style>
</head>

<body>
    <div class="father">
        <div class="son"></div>
    </div>
</body>
</html>